package com.noahplat.person.pojo;

import lombok.Data;
import org.hibernate.validator.constraints.Length;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

/**
 * @ClassName: Life
 * @Description: 生活习惯实体类
 * @Author 李景星
 * @Date 2021/3/8
 * @Version 1.0
 */
@Data
@Table(name = "tb_life")
public class Life {

    @Id
    @KeySql(useGeneratedKeys = true)
    private Long id;    //主键

    private Long pid;   //人员ID

    @NotNull(message = "饮食是否规律不能为空")
    @Length(max = 1, message = "饮食是否规律长度不符合要求")
    private String dietary; //饮食是否规律 是：Y     否：N

    @NotNull(message = "口味偏好不能为空")
    @Length(max = 128, message = "口味偏好长度不符合要求")
    private String taste;   //口味偏好 多选 用,分割

    private Long clitocybine;   //荤素偏好

    private Long smoke; //吸烟情况

    private Long drink; //喝酒情况

    private Long defecate;  //排便情况

    @Transient
    private String clitocybineName; //荤素偏好

    @Transient
    private String smokeName;   //吸烟情况

    @Transient
    private String drinkName;  //饮酒情况

    @Transient
    private String defecateName;    //排便情况

    /**
     * 无参构造
     */
    public Life() {
    }

    /**
     * 有参构造
     * @param pid
     * @param dietary
     * @param taste
     */
    public Life(Long pid, @NotNull(message = "饮食是否规律不能为空") @Length(max = 1, message = "饮食是否规律长度不符合要求") String dietary, @NotNull(message = "口味偏好不能为空") @Length(max = 128, message = "口味偏好长度不符合要求") String taste) {
        this.pid = pid;
        this.dietary = dietary;
        this.taste = taste;
    }
}
